commonlibsse_ng\re\e/
EnchantmentItem.rs

1use crate::re::BGSListForm::BGSListForm;
2use crate::re::FormTypes::FormType;
3use crate::re::MagicItem::{MagicItem, MagicItemVtbl};
4use crate::re::MagicSystem;
5use crate::re::offsets_rtti::RTTI_EnchantmentItem;
6use crate::re::offsets_vtable::VTABLE_EnchantmentItem;
7use crate::rel::id::VariantID;
8
9#[repr(C)]
10#[derive(Debug)]
11pub struct EnchantmentItem {
12    pub __base: MagicItem, // 0x00
13    pub data: Data,
14}
15const _: () = assert!(core::mem::size_of::<EnchantmentItem>() == 0xC0);
16
17impl EnchantmentItem {
18    pub const RTTI: VariantID = RTTI_EnchantmentItem;
19    pub const VTABLE: [VariantID; 3] = VTABLE_EnchantmentItem;
20    pub const FORM_TYPE: FormType = FormType::Enchantment;
21}
22
23#[repr(C)]
24pub struct EnchantmentItemVtbl {
25    pub __base: MagicItemVtbl,
26}
27
28#[commonlibsse_ng_derive_internal::to_bitflags]
29#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
30#[repr(u32)]
31pub enum EnchantmentFlag {
32    None = 0,
33    CostOverride = 1 << 0,
34    FoodItem = 1 << 1,
35    ExtendDuration = 1 << 3,
36}
37
38#[commonlibsse_ng_derive_internal::to_bitflags]
39#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
40#[repr(u32)]
41pub enum RecordFlag {
42    Deleted = 1 << 5,
43    Ignored = 1 << 12,
44}
45
46#[repr(C)]
47#[derive(Debug)]
48pub struct Data {
49    pub costOverride: i32,                     // 0x00
50    pub flags: EnchantmentFlag,                // 0x04
51    pub castingType: MagicSystem::CastingType, // 0x08
52    pub chargeOverride: i32,                   // 0x0C
53    pub delivery: MagicSystem::Delivery,       // 0x10
54    pub spellType: MagicSystem::SpellType,     // 0x14
55    pub chargeTime: f32,                       // 0x18
56    pub pad1C: u32,                            // 0x1C
57    pub baseEnchantment: *mut EnchantmentItem, // 0x20
58    pub wornRestrictions: *mut BGSListForm,    // 0x28
59}
60const _: () = assert!(core::mem::size_of::<Data>() == 0x30);